#ifndef __GAME_HANDLER_H__
#define __GAME_HANDLER_H__
#include <ace/Svc_Handler.h>
#include <ace/SOCK_Connector.h>
#include <ace/Connector.h>
class GameHandler : public ACE_Svc_Handler< ACE_SOCK_Stream , ACE_MT_SYNCH >
{	
	enum{ BUFFER_SIZE=2048 };
public:
	static GameHandler *instance();
public:
	GameHandler();
	~GameHandler();
public:
	int send(void *buffer, size_t size);
	int dispatch();
public:
	int open(void * /* = 0 */);
	int handle_input(ACE_HANDLE fd /* = ACE_INVALID_HANDLE */);
	int handle_output(ACE_HANDLE fd /* = ACE_INVALID_HANDLE */);
	int handle_close(ACE_HANDLE /* = ACE_INVALID_HANDLE */, ACE_Reactor_Mask /* = ACE_Event_Handler::ALL_EVENTS_MASK */);
	int svc(void);
private:
	ACE_Message_Block *_recv_buffer;
	ACE_Message_Block *_send_buffer;
}; 

class GameConnector : public ACE_Connector< GameHandler , ACE_SOCK_Connector >
{
public:
	int make_svc_handler(GameHandler *&sh);
} ;

#endif